using IStrong.EC.Abstractions.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;

namespace IStrong.EC.WebApi.Results.Entity.SiteAdmin
{
    /// <summary>
    /// 测站统计信息
    /// </summary>
    public class SiteStatis:IEntity
    {
        /// <summary>
        /// 行号
        /// </summary>
        public int RowId { get; set; }
        /// <summary>
        /// 省份
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 县
        /// </summary>
        public string County { get; set; }

        /// <summary> 
		/// 报送名称
		/// </summary> 
		public string SubmittedName { get; set; }
        /// <summary> 
		/// 上报单位ID
		/// </summary> 
		public string SubmittedUnit { get; set; }
        /// <summary>
        ///  责任区域
        /// </summary>
        public string Territory { get; set; }

        /// <summary>
        /// 测站总数
        /// </summary>
        public decimal Total { get; set; }

        /// <summary>
        /// 正常来报
        /// </summary>
        public decimal Normal { get; set; }

        /// <summary>
        /// 异常站点
        /// </summary>
        public decimal Abnormity { get { return Total - Normal; } }

        /// <summary>
        /// 异常率
        /// </summary>
        public decimal AbnormityPercentage
        {
            get
            {
                if (Abnormity >= Total && Total > 0 && Abnormity > 0)
                {
                    return 100;
                }
                else if (Abnormity < Total && Abnormity > 0)
                {
                    return Math.Round(Abnormity / Total * 100, 2);
                }
                else
                {
                    return 0;
                }
            }
        }

        /// <summary>
        /// 我司维护测站总数
        /// </summary>
        public decimal MaintainTotal { get; set; }

        /// <summary>
        /// 正常来报
        /// </summary>
        public decimal MaintainNormal { get; set; }

        /// <summary>
        /// 异常站点
        /// </summary>
        public decimal MaintainAbnormity { get { return MaintainTotal - MaintainNormal; } }

        /// <summary>
        /// 异常率
        /// </summary>
        public decimal MaintainAbnormityPercentage
        {
            get
            {
                if (MaintainAbnormity >= MaintainTotal && MaintainTotal > 0 && MaintainAbnormity > 0)
                {
                    return 100;
                }
                else if (MaintainAbnormity < MaintainTotal && MaintainAbnormity > 0)
                {
                    return Math.Round(MaintainAbnormity / MaintainTotal * 100, 2);
                }
                else
                {
                    return 0;
                }
            }
        }

    }
}
